<!-- $Id: brand_info.htm 14216 2008-03-10 02:27:21Z testyang $ -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>ECSHOP 管理中心 - 添加商品分类 </title>
        <meta name="robots" content="noindex, nofollow"/>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="__CSS__/general.css" rel="stylesheet" type="text/css" />
        <link href="__CSS__/main.css" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" href="__ZTREE__/css/zTreeStyle/zTreeStyle.css" type="text/css"/>
        <style type="text/css">
            ul.ztree{
                margin-top: 10px;
                border: 1px solid #617775;
                background: #f0f6e4;
                width: 220px;
                overflow-y: scroll; 
                overflow-x: auto; 
            }
        </style>
    </head>
    <body>
        <h1>
            <span class="action-span"><a href="{:U('index')}">商品商品分类</a></span>
            <span class="action-span1"><a href="#">ECSHOP 管理中心</a></span>
            <span id="search_id" class="action-span1"> - 添加商品分类 </span>
        </h1>
        <div style="clear:both"></div>
        <div class="main-div">
            <form method="post" action="{:U()}" enctype="multipart/form-data" >
                <table cellspacing="1" cellpadding="3" width="100%">
                    <tr>
                        <td class="label">商品分类名称</td>
                        <td>
                            <input type="text" name="name" maxlength="60" value="{$row.name}" />
                            <span class="require-field">*</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="label">父级分类</td>
                        <td>
                            <input type="hidden" name="parent_id" id='parent_id'/>
                            <input type='text' disabled='disabled' id='parent_name' style="padding-left:1em;"/>
                            <ul id="goods_categories" class="ztree"></ul>
                        </td>
                    </tr>
                    <tr>
                        <td class="label">商品分类描述</td>
                        <td>
                            <textarea  name="intro" cols="60" rows="4"  >{$row.intro}</textarea>
                        </td>
                    </tr>
                    <tr>
                        <td class="label">是否显示</td>
                        <td>
                            <input type="radio" name="status" value="1" class="status"/> 是
                            <input type="radio" name="status" value="0" class="status" /> 否
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center"><br />
                            <input type="hidden" name="id" value="{$row.id}" />
                            <input type="submit" class="button" value=" 确定 " />
                            <input type="reset" class="button" value=" 重置 " />
                        </td>
                    </tr>
                </table>
            </form>
        </div>

        <div id="footer">
            共执行 1 个查询，用时 0.018952 秒，Gzip 已禁用，内存占用 2.197 MB<br />
            版权所有 &copy; 2005-2012 上海商派网络科技有限公司，并保留所有权利。
        </div>
        <js href='__JS__/jquery.min.js'/>
        <script type="text/javascript" src="__ZTREE__/js/jquery.ztree.core.js"></script>
        <script type='text/javascript'>
            var setting = {
                data: {
                    simpleData: {
                        enable: true,
                        pIdKey: 'parent_id',
                    },
                },
                callback:{
                    onClick:function(event,node,item){
                        //取出点击节点的数据，放到表单节点中
                        $('#parent_id').val(item.id);
                        $('#parent_name').val(item.name);
                    },
                },
            };

            var goods_categories = {$goods_categories};
            $(function () {
                //回显商品分类状态
                $('.status').val([{$row.status|default=1}]);
                //初始化ztree插件
                var goods_category_ztree = $.fn.zTree.init($("#goods_categories"), setting, goods_categories);
                //展开所有的节点
                goods_category_ztree.expandAll(true);
                
                //编辑页面回显父级分类
                <present name="row">
                    //获取父级分类在ztree中的节点
//                    var parent_node = goods_category_ztree.getNodeByTId({$row.parent_id});
                    var parent_node = goods_category_ztree.getNodeByParam('id',{$row.parent_id});
                    goods_category_ztree.selectNode(parent_node);
                    $('#parent_id').val(parent_node.id);
                    $('#parent_name').val(parent_node.name);
                </present>
            });
        </script>
    </body>
</html>